﻿//-----------------------------------------------------------------------
// <copyright file="Metadata.cs" company="MKCoolsoft">
//     Copyright (c) mkcoolsoft. All rights reserved.
// </copyright>
// <author>Mario Kuhl</author>
// <revision>26.01.2014 Initial version</revision>
//-----------------------------------------------------------------------

namespace MKCoolsoft.GPXLib
{
    #region using

    using System;
    using System.Collections.Generic;
    using System.Xml.Serialization;

    #endregion using

    /// <summary>
    /// Information about the GPX file, author, and copyright restrictions 
    /// goes in the metadata section. Providing rich, meaningful information 
    /// about your GPX files allows others to search for and use your GPS data. 
    /// </summary>
    public class Metadata
    {
        #region private fields

        /// <summary>
        /// The name of the GPX file.
        /// </summary>
        private string nameField;

        /// <summary>
        /// A description of the contents of the GPX file.
        /// </summary>
        private string descField;

        /// <summary>
        /// The person or organization who created the GPX file.
        /// </summary>
        private Person personField;

        /// <summary>
        /// Copyright and license information governing use of the file.
        /// </summary>
        private Copyright copyrightField;

        /// <summary>
        /// URLs associated with the location described in the file.
        /// </summary>
        private List<Link> linkListField;

        /// <summary>
        /// The creation date of the file.
        /// </summary>
        private DateTime timeField;

        /// <summary>
        /// The visibility flag for timeField in then File.
        /// </summary>
        private bool timeSpecifiedField;

        /// <summary>
        /// Keywords associated with the file. Search engines or databases can use 
        /// this information to classify the data.
        /// </summary>
        private string keywordsFields;

        /// <summary>
        /// Minimum and maximum coordinates which describe the extent of the 
        /// coordinates in the file.
        /// </summary>
        private Bounds boundsField;

        /// <summary>
        /// You can add extend GPX by adding your own elements from another schema here.
        /// </summary>
        private Extensions extensionsField;

        #endregion private fields

        #region constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="Metadata"/> class.
        /// </summary>
        public Metadata()
        {
            this.boundsField = new Bounds();
            this.copyrightField = new Copyright();
            this.extensionsField = new Extensions();
            this.linkListField = new List<Link>();
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Metadata"/> class.
        /// This "private" constructor is for hiding the public constructor for 
        /// serialize / deserialize
        /// </summary>
        /// <param name="dummy">This is a dummy parameter.</param>
        private Metadata(int dummy)
        { 
        }

        #endregion constructors

        #region public properties

        /// <summary>
        /// Gets or sets Name for the file.
        /// </summary>
        public string Name
        {
            get
            {
                return this.nameField;
            }

            set
            {
                this.nameField = value;
            }
        }

        /// <summary>
        /// Gets or sets the description for the file.
        /// </summary>
        public string Desc
        {
            get
            {
                return this.descField;
            }

            set
            {
                this.descField = value;
            }
        }

        /// <summary>
        /// Gets or sets the Author from the file.
        /// </summary>
        public Person Author
        {
            get
            {
                return this.personField;
            }

            set
            {
                this.personField = value;
            }
        }

        /// <summary>
        /// Gets or sets the Copyright for the file.
        /// </summary>
        public Copyright Copyright
        {
            get
            {
                return this.copyrightField;
            }

            set
            {
                this.copyrightField = value;
            }
        }

        /// <summary>
        /// Gets or sets the LinkList.
        /// </summary>
        [XmlElementAttribute("link")]
        public List<Link> LinkList
        {
            get
            {
                return this.linkListField;
            }

            set
            {
                this.linkListField = value;
            }
        }

        /// <summary>
        /// Gets or sets the creation timestamp for the file.
        /// </summary>
        public DateTime Time
        {
            get
            {
                return this.timeField;
            }

            set
            {
                this.timeField = value;
            }
        }

        /// <summary>
        /// Gets or sets a value indicating whether the Timestamp is enabled.
        /// </summary>
        [XmlIgnoreAttribute]
        public bool TimeSpecified
        {
            get
            {
                return this.timeSpecifiedField;
            }

            set
            {
                this.timeSpecifiedField = value;
            }
        }

        /// <summary>
        /// Gets or sets the Keywords.
        /// </summary>
        public string Keywords
        {
            get
            {
                return this.keywordsFields;
            }

            set
            {
                this.keywordsFields = value;
            }
        }

        /// <summary>
        /// Gets or sets the Keywords.
        /// </summary>
        public Bounds Bounds
        {
            get
            {
                return this.boundsField;
            }

            set
            {
                this.boundsField = value;
            }
        }

        /// <summary>
        /// Gets or sets the Keywords.
        /// </summary>
        public Extensions Extensions
        {
            get
            {
                return this.extensionsField;
            }

            set
            {
                this.extensionsField = value;
            }
        }

        #endregion public properties
    }
}
